Easy2Siksha Sample Paper
(GNDU) MOST REPEATED (IMPORTANT) QUESTIONS
BCA 1st SEMESTER
Introducon to Programming in C
1. Pointers – Denion, uses, pointer to funcons / accessing arrays / call by reference /
types of pointers
o Frequency: 5 mes
o Years Appeared: 2020, 2021, 2022, 2023, 2024
2. Recursion – Denion, condions, factorial program / Fibonacci series
o Frequency: 4 mes
o Years Appeared: 2020, 2021, 2022, 2024
3. Structures and Unions – Denion, dierences, uses, examples
o Frequency: 4 mes
o Years Appeared: 2020, 2021, 2022, 2024
Easy2Siksha Sample Paper
󹺔󹺒󹺓 2025 Smart Predicon Table
(Based on 5-Year Analysis: Frequency + Recentness + Core Syllabus Weight)
Queson Topic
Repeats
Years Appeared
Priority
Level
Pointers – denion, uses, pointer to funcons /
arrays / call by reference / types
5
2020, 2021, 2022,
2023, 2024
󽇐 Very
High
Recursion – factorial / Fibonacci
4
2020, 2021, 2022,
2024
󽇐 Very
High
Structures vs Unions – dierences, uses
4
2020, 2021, 2022,
2024
󽇐 Very
High
(GNDU) MOST REPEATED (IMPORTANT) ANSWER
BCA 1st SEMESTER
Introducon to Programming in C
1. Pointers – Denion, uses, pointer to funcons / accessing arrays / call by reference /
types of pointers
o Frequency: 5 mes
o Years Appeared: 2020, 2021, 2022, 2023, 2024
Ans: Part 1 Pointers in C: The “Treasure Map” of Programming
A Different Beginning The Treasure Hunt
Imagine you’re part of a treasure hunt game. You’re given two options:
Easy2Siksha Sample Paper
1. Carry the treasure chest everywhere you go (heavy, slow, risky).
2. Carry a map with the exact location of the treasure (light, quick, easy to share).
In C programming:
Carrying the treasure chest = storing and passing the actual data.
Carrying the map = storing and passing the address of the data.
That “map” in C is called a pointer.
Definition
A pointer is a special variable that stores the memory address of another variable. Instead
of holding a value like 42, it holds something like 0x7ffee4b8 the location in RAM where
that value is stored.
Why Pointers Matter
Pointers are not just a quirky C feature they are the backbone of:
Efficiency: Passing addresses instead of whole data saves time and memory.
Flexibility: Functions can modify variables outside their own scope.
Dynamic Memory: Allocate memory at runtime (malloc, calloc).
Complex Data Structures: Linked lists, trees, graphs.
Function Pointers: Allow callbacks and dynamic function selection.
Accessing Arrays with Pointers
Arrays and pointers are like two sides of the same coin:
The name of an array (arr) is essentially the address of its first element.
You can use pointer arithmetic to move through an array.
Analogy: Think of an apartment building:
The building’s address = array name.
Each flat = an element.
Adding 1 to the address moves you to the next flat.
So:
arr[0] *(arr + 0)
arr[1] *(arr + 1)
Call by Reference with Pointers
Easy2Siksha Sample Paper
When you pass variables to a function in C, by default it’s call by value a copy is made. If
you want the function to change the original variable, you pass its address this is call by
reference.
Story version: If you give your friend a photocopy of your house key (call by value), they
can’t open your real house. If you give them the actual key (address), they can go inside and
rearrange the furniture (change the variable).
Pointer to Functions
A function pointer stores the address of a function. Why is this useful?
Pass functions as arguments (callbacks).
Choose which function to run at runtime.
Create tables of functions for menus or operations.
Analogy: It’s like having a remote control that can be paired with different TVs the
remote (pointer) doesn’t store the TV, just the signal address to control it.
Types of Pointers
1. Null Pointer: Points to nothing (NULL), used for safety checks.
2. Void Pointer: Generic pointer that can point to any data type.
3. Wild Pointer: Uninitialized pointer dangerous, avoid using.
4. Dangling Pointer: Points to memory that’s been freed — also dangerous.
5. Function Pointer: Points to a function’s code location.
6. Pointer to Pointer: Stores the address of another pointer.
Diagram Pointer Concept
Variable: num = 10
Address: 0x1000
Pointer: p = 0x1000
*p (value at address) = 10
Here, p doesn’t hold 10 — it holds where 10 is stored.
Exam-Friendly Flow for Pointers
When answering in exams:
1. Start with a clear definition.
2. Give a relatable analogy (map, treasure, key).
3. Mention uses.
4. Explain call by reference.
5. Touch on pointer to functions.
6. List types.
Easy2Siksha Sample Paper
7. Add a neat diagram.
Part 2 Taking Numeric Input in Python: The “Cashier Counter” Conversation
A Different Beginning The Grocery Store Checkout
You’re at a grocery store checkout. The cashier asks:
“How many apples are you buying?”
You say: “5”.
The cashier types it into the billing machine but here’s the twist: the machine hears it as
text (“5”), not as a number. Before it can multiply by the price per apple, it must convert
that text into a number.
This is exactly what happens in Python when you take numeric input from a user.
The input() Function
input() pauses the program and waits for the user to type something.
Whatever the user types is returned as a string even if they type 42.
Why Conversion is Needed
x = input("Enter a number: ")
and enter 5, Python stores "5" (string). If you try x + 2, you’ll get an error — because you
can’t add a string and a number.
Type Casting
To turn the string into a number:
int() → for whole numbers.
float() → for decimals.
Example in concept:
age = int(input("Enter your age: "))
Now age is an integer, ready for calculations.
Multiple Numeric Inputs
You can take several numbers at once:
a, b = map(int, input("Enter two numbers: ").split())
Easy2Siksha Sample Paper
If the user types 5 7, a becomes 5, b becomes 7.
Validating Input
What if the user types “three” instead of 3? Your program will crash unless you handle it.
Safe approach:
Use try-except to catch conversion errors.
Ask again if the input is invalid.
Flow Diagram Numeric Input
[Prompt user with input()]
[User types something]
[Stored as string]
[Convert to int() or float()]
[Use in calculations]
Why This Matters
Numeric input is the foundation for:
Calculators
Billing systems
Games (scores, levels)
Data entry forms
Without it, your program can’t interact meaningfully with the user.
Exam-Friendly Flow for Numeric Input
1. Define input() and its behaviour.
2. Explain that it returns a string.
3. Show why conversion is needed.
4. Mention int() and float().
5. Add a note on validation.
6. Use a simple diagram.
Bringing It Together
Both Pointers in C and Numeric Input in Python are about access:
Pointers give you access to data in memory.
Easy2Siksha Sample Paper
Numeric input gives your program access to data from the user.
One works behind the scenes with memory addresses, the other works at the front desk,
talking to the user. But in both cases, you’re dealing with how information flows either
from one part of the program to another, or from the outside world into your code.
2. Recursion – Denion, condions, factorial program / Fibonacci series
o Frequency: 4 mes
o Years Appeared: 2020, 2021, 2022, 2024
Ans: A Different Beginning The Magic Mirror Story
Imagine you’re standing in front of two mirrors placed face-to-face. You look into one, and
you see yourself… inside another mirror… and another… and another… going on seemingly
forever.
Now imagine that instead of just reflecting your image, each “you” in the mirror is doing a
small part of a task and then passing the rest of the work to the “you” in the next mirror.
Eventually, the last “you” finishes the smallest piece of the job and sends the result back
through all the mirrors until it reaches you.
That’s recursion in programming: A function that calls itself to solve a problem by breaking
it into smaller, similar problems until it reaches a point where it can stop.
1. Definition of Recursion
In programming (and specifically in C), recursion is a technique where a function calls itself
directly or indirectly to solve a problem.
The idea is:
Break a big problem into smaller sub-problems of the same type.
Solve the smallest version directly (this is the base case).
Combine results as the function calls “unwind”.
2. How Recursion Works The Two Key Parts
Every recursive function has two essential parts:
1. Base Case (Stopping Condition)
o This is the condition under which the function stops calling itself.
o Without it, the function would keep calling itself forever, causing a stack
overflow error.
Easy2Siksha Sample Paper
o Think of it as the “last mirror” in our story — the point where the task is so
small it can be done immediately.
2. Recursive Case
o This is where the function calls itself with a smaller or simpler version of the
original problem.
o Each call moves closer to the base case.
Diagram Flow of Recursion
[Function Call]
Check Base Case? → Yes → Return result
↓ No
Do small part of work
Call itself with smaller problem
Repeat until base case
Return results back up the chain
3. Conditions for Implementing Recursion
For recursion to work correctly and efficiently:
1. Base Case Must Exist There must be at least one condition where the function
returns without making another recursive call.
2. Progress Toward Base Case Each recursive call should bring the problem closer to
the base case.
3. Correct Return Values The function should return the correct result from both the
base case and the recursive case.
4. Finite Calls The recursion must end after a finite number of steps.
5. Sufficient Stack Memory Each call uses stack space; deep recursion can cause
overflow.
4. Why Use Recursion?
Simplifies Complex Problems: Some problems (like tree traversal, factorial,
Fibonacci) are naturally recursive.
Cleaner Code: Often shorter and easier to read than iterative solutions.
Mathematical Elegance: Matches the way many problems are defined
mathematically.
5. Factorial Program Understanding Through Recursion
What is Factorial?
The factorial of a number n (written as n!) is:
n! = n × (n-1) × (n-2) × ... × 1
Easy2Siksha Sample Paper
Example:
5! = 5 × 4 × 3 × 2 × 1 = 120
Mathematical Recursive Definition
n! = 1 if n = 0 or n = 1 (Base Case)
n! = n × (n-1)! if n > 1 (Recursive Case)
How It Works Step-by-Step for 5!
1. factorial(5) = 5 × factorial(4)
2. factorial(4) = 4 × factorial(3)
3. factorial(3) = 3 × factorial(2)
4. factorial(2) = 2 × factorial(1)
5. factorial(1) = 1 (Base Case reached)
Now the results return:
factorial(2) = 2 × 1 = 2
factorial(3) = 3 × 2 = 6
factorial(4) = 4 × 6 = 24
factorial(5) = 5 × 24 = 120
Visual Diagram Factorial Recursion
factorial(5)
→ 5 × factorial(4)
→ 4 × factorial(3)
→ 3 × factorial(2)
→ 2 × factorial(1)
→ 1 (Base Case)
Then the chain unwinds with multiplication.
6. Fibonacci Series Another Classic Recursion Example
What is the Fibonacci Series?
A sequence where each number is the sum of the two preceding ones:
0, 1, 1, 2, 3, 5, 8, 13, ...
Mathematical Recursive Definition
F(0) = 0 (Base Case 1)
F(1) = 1 (Base Case 2)
F(n) = F(n-1) + F(n-2) (Recursive Case)
How It Works for F(5)
Easy2Siksha Sample Paper
1. F(5) = F(4) + F(3)
2. F(4) = F(3) + F(2)
3. F(3) = F(2) + F(1)
4. F(2) = F(1) + F(0)
5. F(1) = 1 (Base Case)
6. F(0) = 0 (Base Case)
The calls branch out like a tree, and results bubble back up.
Diagram Fibonacci Recursion Tree for F(4)
F(4)
/ \
F(3) F(2)
/ \ / \
F(2) F(1) F(1) F(0)
/ \
F(1) F(0)
7. Comparing Factorial and Fibonacci Recursion
Feature
Factorial
Fibonacci
Base Cases
n=0 or n=1 → return 1
n=0 → return 0, n=1 → return 1
Recursive Step
n × factorial(n-1)
F(n-1) + F(n-2)
Call Pattern
Linear (one call per step)
Tree-like (two calls per step)
Efficiency
More efficient
Less efficient (repeats work)
8. Advantages of Recursion
Matches natural problem definitions.
Reduces code size for certain problems.
Easier to implement for problems like:
o Tree/graph traversal
o Divide-and-conquer algorithms (merge sort, quicksort)
o Mathematical sequences
9. Disadvantages of Recursion
More memory usage (each call uses stack space).
Slower than iteration for some problems.
Risk of stack overflow if base case is wrong or missing.
Sometimes repeats work (like naive Fibonacci).
10. Tips for Writing Recursive Functions
1. Clearly define the base case(s).
2. Ensure each call moves toward the base case.
3. Avoid unnecessary repeated calculations.
4. Test with small inputs first.
Easy2Siksha Sample Paper
5. Consider iteration if recursion is inefficient.
11. Real-Life Analogy Recap
Factorial: Like peeling an onion layer by layer until you reach the core, then putting
the layers back together.
Fibonacci: Like a family tree where each person’s existence depends on the two
before them.
Conclusion
Recursion is like teaching a helper to solve a problem by giving them a smaller version of the
same problem and trusting them to keep doing that until it’s so small they can solve it
instantly. Whether it’s calculating a factorial or generating a Fibonacci number, recursion
turns big problems into a chain of smaller, familiar ones, and then stitches the answers back
together.
3. Structures and Unions – Denion, dierences, uses, examples
o Frequency: 4 mes
o Years Appeared: 2020, 2021, 2022, 2024
Ans: A Different Beginning The Tale of Two Roommates
Imagine two friends, Structo and Unio, who decide to rent an apartment together.
Structo says: “I’ll have my own cupboard, my own shelf, my own bed everything
separate.”
Unio says: “I’m fine sharing the same cupboard, shelf, and bed — but only one of us
can use each at a time.”
This is exactly the difference between Structures and Unions in C programming. Both are
ways to group different types of data under one name, but they manage memory in very
different ways.
1. Definition of Structure
A Structure in C is a user-defined data type that allows you to combine variables of
different types under a single name.
Easy2Siksha Sample Paper
Declared using the keyword struct.
Each member has its own separate memory space.
All members can hold values at the same time.
Analogy: Structo’s apartment every item has its own space.
Syntax (Conceptual)
struct Student {
char name[50];
int age;
float marks;
};
Here:
name is a string (array of chars)
age is an integer
marks is a float All three have their own memory.
2. Definition of Union
A Union in C is also a user-defined data type that groups different variables under one
name, but:
Declared using the keyword union.
All members share the same memory location.
Only one member can hold a valid value at a time.
Analogy: Unio’s apartment — one cupboard, one shelf, one bed, shared by all. If Unio puts
clothes in the cupboard, the books that were there before are gone.
Syntax (Conceptual)
c
union Data {
int i;
float f;
char str[20];
};
Here:
i, f, and str share the same memory.
The size of the union = size of its largest member.
3. Memory Allocation Difference
This is the heart of the difference:
Easy2Siksha Sample Paper
Structure
Union
Separate memory for each
member
Shared memory for all members
Sum of sizes of all members (plus
padding)
Size of largest member (plus
padding)
Can store values in all members
at once
Only one member’s value is valid
at a time
Example: If int = 4 bytes, float = 4 bytes, char[20] = 20 bytes:
Structure size ≈ 4 + 4 + 20 = 28 bytes (plus padding).
Union size = max(4, 4, 20) = 20 bytes (plus padding).
4. Accessing Members
Structure: You can read/write all members independently.
Union: Writing to one member overwrites the others.
5. Uses of Structures
Structures are used when:
You need to store different types of related data together.
All members’ values are needed at the same time.
Examples:
o Student record (name, roll number, marks)
o Employee record (ID, salary, department)
o Coordinates (x, y, z)
6. Uses of Unions
Unions are used when:
You need to store different types of data in the same memory location (memory
saving).
Only one member’s value is needed at a time.
Examples:
o Embedded systems where memory is limited.
o Interpreting the same memory in different ways (type punning).
o Handling multiple data formats in a single variable.
7. Real-Life Analogy Recap
Structure: Like a multi-compartment lunchbox rice in one, curry in another, salad
in another. All exist together.
Union: Like a single bowl you can have rice or curry or salad, but not all at once.
8. Example Walkthrough (Conceptual)
Easy2Siksha Sample Paper
Structure Example
struct Student {
char name[20];
int age;
float marks;
};
struct Student s1 = {"Ravi", 20, 85.5};
Here:
Memory is allocated for name, age, and marks separately.
You can access all three without losing data.
Union Example
union Data {
int i;
float f;
char str[20];
};
union Data d1;
d1.i = 10; // stores integer
d1.f = 3.14; // overwrites integer with float
After storing f, the value of i is no longer valid.
9. Diagram Memory Representation
Structure:
| name[20] | age (4 bytes) | marks (4 bytes) |
Each member has its own block.
Union:
| Shared Memory (size = largest member) |
All members overlap in the same block.
10. Key Differences Table
Aspect
Structure
Union
Keyword
struct
union
Memory
Separate for each member
Shared among all members
Size
Sum of all members
Size of largest member
Store multiple values
Yes
No
Use case
All data needed together
One data type at a time
Data overwrite
No
Yes
Easy2Siksha Sample Paper
11. Advantages & Disadvantages
Structures:
󷄧󼿒 Can store multiple values at once.
󷄧󼿒 Easy to understand and use.
󽆱 Uses more memory.
Unions:
󷄧󼿒 Saves memory.
󷄧󼿒 Useful for multi-format data.
󽆱 Only one value valid at a time.
󽆱 Risk of accidental overwrite.
12. When to Choose Which
Use Structure when you need all members’ data simultaneously.
Use Union when you need only one member’s data at a time and want to save
memory.
14. Conclusion
Structures and Unions are like two different philosophies of living:
Structures believe in personal space everyone gets their own.
Unions believe in sharing space but only one can use it at a time.
Both are powerful tools in C, and knowing when to use which can make your programs more
efficient and easier to manage.
“This is only a part of the preparation journey.
For full access to repeated questions and detailed answers, purchase our
Premium Papers and boost your chances of scoring higher!”